package com.fristvue.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.fristvue.dao.UsersDao;
import com.fristvue.po.Users;
import com.fristvue.po.Util.Page;
import com.fristvue.service.UsersService;

@Service
public class UsersServiceImpl implements UsersService {
	@Autowired
	private UsersDao usersDao; //自动注入
	//查询出Id的用户信息
	@Override
	public Users selectByPrimaryKey(Integer userId) {
		// TODO Auto-generated method stub
		 
		return this.usersDao.selectByPrimaryKey(userId);
	}
	//查询出所有用户
	@Override
	public Page<Users> selectAllUsers(Integer num, Integer size, Users users) {
		// TODO Auto-generated method stub
		Page<Users> userPage = new Page<Users>();
		userPage.setList(this.usersDao.selectAllUsers(num, size, users));
		userPage.setNum(this.usersDao.UsersCount(users));
		return userPage;
	}
	//删除指定的用户
	@Override
	public boolean deleteByPrimaryKey(Integer userId) {
		// TODO Auto-generated method stub
		return this.usersDao.deleteByPrimaryKey(userId);
	}
	//使用手机号码和密码进行登录
	@Override
	public Users UsePhoneLoginFindUser(String phone, String password) {
		// TODO Auto-generated method stub
		return this.usersDao.UsePhoneLoginFindUser(phone, password);
	}
	//利用邮件进行登录
	@Override
	public Users UseEmailLoginFindUser(String email) {
		// TODO Auto-generated method stub
		return this.usersDao.UseEmailLoginFindUser(email);
	}
	@Override
	public boolean insertUser(Users users) {
		// TODO Auto-generated method stub
		return this.usersDao.insertUser(users);
	}
	@Override
	public boolean editUsers(Users users) {
		// TODO Auto-generated method stub
		return this.usersDao.editUsers(users);
	}
	@Override
	public List<Users> WhereUsers() {
		// TODO Auto-generated method stub
		return this.usersDao.WhereUsers();
	}

}
